package thread.java20230113;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 两个线程对日期进行初始化
 */
public class Demo57 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            Date date = new Date(1 * 1000);//1s
            System.out.println(dateFormat(date));
        });
        Thread t2 = new Thread(()->{
            Date date = new Date(2 * 1000);//2s
            System.out.println(dateFormat(date));
        });
        t1.start();
        t2.start();

    }

    private static String dateFormat(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
        return simpleDateFormat.format(date);//1990-01-01 12:23:56    12:23:56   12:23   1990-01-01
    }
}
